unit dgEditShape ;

interface

uses Windows,
   SysUtils,
   Classes,
   Graphics,
   Forms,
   Controls,
   StdCtrls,
   Buttons,
   ExtCtrls,
   SpTBXEditors,
   SpTBXControls,
   TBXDkPanels,
   uObjects,
   GDIPAPI,
   GDIPOBJ ;

type
   TdlgEditShape = class( TForm )
      Panel : TSpTBXPanel ;
      btOK : TSpTBXButton ;
      btCancel : TSpTBXButton ;
      SpTBXGroupBox2 : TSpTBXGroupBox ;
      edDesignator : TSpTBXButtonEdit ;
      SpTBXGroupBox3 : TSpTBXGroupBox ;
      edLabel : TSpTBXButtonEdit ;
      SpTBXGroupBox1 : TSpTBXGroupBox ;
      seSizeX : TSpTBXSpinEdit ;
      seSizeY : TSpTBXSpinEdit ;
      btApply : TSpTBXButton ;
      procedure btOKClick( Sender : TObject ) ;
      procedure FormCreate( Sender : TObject ) ;
      procedure btApplyClick( Sender : TObject ) ;
   private
      fShape : TMedaShape ;
      procedure SetShape( const Value : TMedaShape ) ;
      procedure SetTitle( const Value : string ) ;
   public
      property Title : string write SetTitle ;
      property Shape : TMedaShape read fShape write SetShape ;
   end ;

implementation

{$R *.dfm}

{ TdlgEditBank }

procedure TdlgEditShape.btApplyClick( Sender : TObject ) ;
var
   iRect            : TGPRectF ;
begin
   if assigned( fShape ) then begin
      fShape.Name := edLabel.Text ;
      fShape.Designator := edDesignator.Text ;
      iRect.Width := seSizeX.Value ;
      iRect.Height := seSizeY.Value ;
      iRect.X := -iRect.Width / 2 ;
      iRect.Y := -iRect.Height / 2 ;
      fShape.Outline := iRect ;
//      fShape.BuildOutline ;
   end ;
end ;

procedure TdlgEditShape.FormCreate( Sender : TObject ) ;
begin
   Caption := ' Add Bank' ;
   fShape := nil ;
   edLabel.Text := '' ;
   edDesignator.Text := '' ;
end ;

procedure TdlgEditShape.SetShape( const Value : TMedaShape ) ;
begin
   fShape := Value ;
   if assigned( fShape ) then begin
      edLabel.Text := fShape.Name ;
      edDesignator.Text := fShape.Designator ;
      seSizeX.Value := fShape.Outline.Width ;
      seSizeY.Value := fShape.Outline.Height ;
   end ;
end ;

procedure TdlgEditShape.SetTitle( const Value : string ) ;
begin
   Caption := Value ;
end ;

procedure TdlgEditShape.btOKClick( Sender : TObject ) ;
begin
   btApplyClick( Sender ) ;
end ;

end.

